# Maintainer: Andrew Crerar <crerar@archlinux.org>
# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Hideaki Takahashi <mymelo+aur@gmail.com>
# Contributor: Vincent Demeester <vincent@sbr.io>
# Contributor: Josh VanderLinden <arch@cloudlery.com>

pkgname=python-docker
pkgver=6.1.3
pkgrel=1
pkgdesc="A Python library for the Docker Engine API"
arch=('any')
url="https://github.com/docker/docker-py"
license=("Apache")
depends=('python-packaging' 'python-requests' 'python-urllib3' 'python-websocket-client')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-setuptools-scm' 'python-wheel')
checkdepends=('flake8' 'python-coverage' 'python-paramiko' 'python-pytest'
'python-pytest-cov' 'python-pytest-timeout')
optdepends=('python-paramiko: for connections using the SSH protocol')
provides=('python-docker-py')
conflicts=('python-docker-py')
replaces=('python-docker-py')
source=("$pkgname-$pkgver.tar.gz::https://github.com/docker/docker-py/archive/$pkgver.tar.gz")
b2sums=('b5a54d2bcbb4a89e4861bbf59a9b4565886f5541a518f66691ae205b7581f73af9fe6d491af299b0295f39b4a6e6248871b16e25ea5650fabbeafb7ced6cdaf7')

prepare() {
  sed -i 's/==.*$//' docker-py-"$pkgver"/{,test-}requirements.txt
}

build() {
  cd docker-py-"$pkgver"
  export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd docker-py-"$pkgver"
  py.test --cov=docker tests/unit
}

package() {
  cd docker-py-"$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl
}
